package com.fqgj.xjd.user.client.enums;

/**
 * @program: cashmama-user
 * @description 用户权益类型 0权益 1积分
 * @author: frank
 * @create: 2020-04-14 14:47
 **/
public enum UserRewardEnum {

    REWARD(0, "reward"),POINT(1, "point");

    private Integer code;
    private String name;

    UserRewardEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public Integer getCode() {
        return code;
    }

    public UserRewardEnum setCode(Integer code) {
        this.code = code;
        return this;
    }

    public String getName() {
        return name;
    }

    public UserRewardEnum setName(String name) {
        this.name = name;
        return this;
    }

    public static UserRewardEnum getByCode(Integer code){
        if(code == null){
            return null;
        }
        for(UserRewardEnum userRewardEnum : UserRewardEnum.values()){
            if(userRewardEnum.getCode() == code){
                return userRewardEnum;
            }
        }
        return null;
    }
}
